<!--
 ! Excerpted from "Agile Web Development with Rails, 3rd Ed.",
 ! published by The Pragmatic Bookshelf.
 ! Copyrights apply to this code. It may not be used to create training material, 
 ! courses, books, articles, and the like. Contact us if you are in doubt.
 ! We make no guarantees that this code is fit for any purpose. 
 ! Visit http://www.pragmaticprogrammer.com/titles/rails3 for more book information.
-->
<% @page_title = "Checkout" -%>

<%= error_messages_for(:order) %>


<%= render_component(:action => "display_cart",
                     :params => { :context => :checkout }) %>


<h3>Please enter your details below</h3>

<% form_tag(:action => "save_order") do %>
<table>
 <tr>
  <td>Name:</td>

  <td><%= text_field("order", "name", "size" => 40 ) %></td>
 </tr>
 <tr>
  <td>EMail:</td>
  <td><%= text_field("order", "email", "size" => 40 ) %></td>
 </tr>
 <tr valign="top">
  <td>Address:</td>
  <td><%= text_area("order", "address", "cols" => 40, "rows"  => 5) %></td>
 </tr>

 <tr>
   <td>Pay using:</td>
   <td><%= 
     options = [["Select a payment option", ""]] + Order::PAYMENT_TYPES
     select("order", "pay_type", options) 
   %></td>
 </tr>
 <tr>
   <td></td>
   <td><%= submit_tag(" CHECKOUT ") %></td>
 </tr>
</table>
<% end %>
